/**
 * Created by Administrator on 2016/11/26 0026.
 */


window.onload = function()
{

    /*鼠标移入图片放大开始*/
    var oTable = document.getElementsByClassName('table')[0];
    var aNormalImg = oTable.getElementsByClassName('normalImg');
    var aActiveImg = oTable.getElementsByClassName('activeImg');
    for(var i=0;i<aNormalImg.length;i++)
    {
        aNormalImg[i].index = i;
        aNormalImg[i].onmouseover = function()
    {
        this.style.border = 'solid 2px #333';
        //this.style.opacity = 0.4;
        aActiveImg[this.index].style.display = 'block';
    };
        aNormalImg[i].onmouseout = function()
        {
            this.style.border = 'none';
            //this.style.opacity = 1.0;
            aActiveImg[this.index].style.display = 'none';
        }
    }
    /*鼠标移入图片放大结束*/



    /*选中或取消多选框后，分别全选或者取消全选开始*/
    var aTable = document.getElementsByTagName('table');
    var oCheck = aTable[0].getElementsByTagName('thead')[0].getElementsByTagName('input')[0];
    var aCheck = aTable[0].getElementsByTagName('tbody')[0].getElementsByTagName('input');

    oCheck.onclick = function()
    {
        for(var i=0;i<aCheck.length;i++)
        {
            if(oCheck.checked ==true)
            {
                aCheck[i].checked = true;
            }
            else
            {
                aCheck[i].checked = false;
            }
        }
    };
    /*选中或取消多选框后，分别全选或者取消全选开始*/



    /*删除选项提示框开始*/
        //获取批量删除按钮和批量删除提示框内确定与取消按钮
    var oBatchDeleteBtn = document.getElementsByClassName('batchDelete')[0];
    var oShade1 = document.getElementsByClassName('shade1')[0];
    var oSureBtn1 = oShade1.getElementsByTagName('button')[0];
    var oCancelBtn1 = oShade1.getElementsByTagName('button')[1];

        //获取单项删除按钮和单项删除提示框内的确定与取消按钮
    var aDeleteBtn = document.getElementsByClassName('deleteBtn');
    var oShade2 = document.getElementsByClassName('shade2')[0];
    var oSureBtn2 = oShade2.getElementsByTagName('button')[0];
    var oCancelBtn2 = oShade2.getElementsByTagName('button')[1];

    function shadeShowHidden(name,value)
    {
        name.style.display = value;
    }
        //批量删除提示框隐藏与显示
    oBatchDeleteBtn.onclick = function(){shadeShowHidden(oShade1,'block');};
    oSureBtn1.onclick = function(){shadeShowHidden(oShade1,'none');};
    oCancelBtn1.onclick = function(){shadeShowHidden(oShade1,'none');};

        //单项删除提示框隐藏与显示
    for(var i=0;i<aDeleteBtn.length;i++)
    {
        aDeleteBtn[i].index = i;
        aDeleteBtn[i].onclick = function(){shadeShowHidden(oShade2,'block');};
    }
    oSureBtn2.onclick = function(){shadeShowHidden(oShade2,'none');};
    oCancelBtn2.onclick = function(){shadeShowHidden(oShade2,'none');};
    /*删除选项提示框结束*/

};